package org.example;

import com.google.gson.internal.LinkedTreeMap;
import com.google.gson.reflect.TypeToken;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgnitionEx;
import org.junit.Test;
import org.my.stock.h2.MaiDian;
import org.my.stock.h2.MyDongFangStockH2;
import org.my.stock.h2.MyDongFangStockH2_m;
import org.my.stock.h2.MyDongFangStockH2_wm;
import org.my.stock.util.DbToDb;
import org.my.stock.util.MyDongFangStock;
import org.my.stock.util.MyUtil;

import java.beans.PropertyVetoException;
import java.sql.*;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MyUpateCase {

    @Test
    public void test_url() {
        String url = MyDongFangStock.getUrl("301078");
        System.out.println(url);
    }

    @Test
    public void test_df_stock_date() throws IgniteCheckedException {
        MyDongFangStock.updateAll();
    }

    @Test
    public void test_df_stock_date_h2() throws SQLException, ClassNotFoundException, IgniteCheckedException, PropertyVetoException {
        MyDongFangStockH2.updateAll();
        //MyDongFangStockH2.updateAll_ex();
    }

    @Test
    public void test_df_stock() throws SQLException, ClassNotFoundException, IgniteCheckedException, PropertyVetoException {
        MyDongFangStockH2.getData(MyUtil.getConnection(), "301046");
        //MyDongFangStockH2.updateAll_ex();
    }

    @Test
    public void not_update() throws ClassNotFoundException, SQLException {
        Class.forName("org.h2.Driver");
        Connection conn = DriverManager.getConnection("jdbc:h2:~/data;AUTO_SERVER=TRUE", "root", "root");

        String sql = "SELECT symbol FROM type_stock GROUP BY symbol";
        PreparedStatement stmt = conn.prepareStatement(sql);
        ResultSet rs = stmt.executeQuery();
        while (rs.next()) {
            String symbol = rs.getString(1);
            if (!symbol.startsWith("9")) {
                //getData_ex(conn, rs.getString(1));
                if (not_update_today(conn, symbol) == false) {
                    System.out.println(symbol);
                }
            }
        }

        if (rs != null) rs.close();
        if (stmt != null) stmt.close();
        if (conn != null) conn.close();
    }

    public Boolean not_update_today(Connection conn, String symbol) {
        String sql = "SELECT ID FROM df_stock_date WHERE SYMBOL = '"+ symbol +"' and STOCK_DATE = '2025-07-07'";

        PreparedStatement stmt = null;
        ResultSet rs = null;
        Boolean flag = false;

        try {
            stmt = conn.prepareStatement(sql);

            // 5. 执行查询并获取结果集
            rs = stmt.executeQuery();

            // 6. 遍历结果集并处理数据
            while (rs.next()) {
                flag = true;
            }

        } catch (SQLException e) {
            System.err.println("数据库操作失败！错误信息：" + e.getMessage());
            e.printStackTrace();
        } finally {
            // 7. 关闭资源（反向顺序）
            try {
                if (rs != null) rs.close();
                if (stmt != null) stmt.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        return flag;
    }

    @Test
    public void test_df_stock_line() {
        String line = "jQuery112308788068735906851_1744518781844({\"rc\":0,\"rt\":22,\"svr\":181669693,\"lt\":1,\"full\":0,\"dlmkts\":\"\",\"data\":{\"code\":\"301046\",\"market\":0,\"name\":\"能辉科技\",\"klines\":[\"2024-12-09,-968324.0,125225.0,843099.0,-968324.0,0.0,-3.10,0.40,2.70,-3.10,0.00,22.26,-0.04,0.00,0.00\",\"2024-12-10,-1961501.0,1497029.0,464473.0,-1961501.0,0.0,-4.45,3.40,1.05,-4.45,0.00,22.26,0.00,0.00,0.00\",\"2024-12-11,-2176289.0,1723419.0,452870.0,-2176289.0,0.0,-7.23,5.73,1.51,-7.23,0.00,22.20,-0.27,0.00,0.00\",\"2024-12-12,1161909.0,1342299.0,-2504208.0,2266909.0,-1105000.0,3.24,3.74,-6.97,6.31,-3.08,22.23,0.14,0.00,0.00\",\"2024-12-13,7281328.0,-4758411.0,-2522917.0,7046618.0,234710.0,15.28,-9.99,-5.29,14.79,0.49,22.12,-0.49,0.00,0.00\",\"2024-12-16,-3473393.0,1064862.0,2408531.0,-3473393.0,0.0,-11.19,3.43,7.76,-11.19,0.00,21.85,-1.22,0.00,0.00\",\"2024-12-17,-4626527.0,4039754.0,586773.0,810828.0,-5437355.0,-12.61,11.01,1.60,2.21,-14.81,20.93,-4.21,0.00,0.00\",\"2024-12-18,-1574091.0,2577582.0,-1003491.0,-1574091.0,0.0,-8.12,13.30,-5.18,-8.12,0.00,20.80,-0.62,0.00,0.00\",\"2024-12-19,-4551791.0,2647495.0,1904296.0,-1667954.0,-2883837.0,-18.52,10.77,7.75,-6.79,-11.73,20.70,-0.48,0.00,0.00\",\"2024-12-20,6905135.0,-3184438.0,-3720697.0,6905135.0,0.0,15.66,-7.22,-8.44,15.66,0.00,21.50,3.86,0.00,0.00\",\"2024-12-23,2131473.0,-2674615.0,543142.0,2131473.0,0.0,6.50,-8.15,1.66,6.50,0.00,20.62,-4.09,0.00,0.00\",\"2024-12-24,-2694475.0,-3830182.0,6524657.0,1366544.0,-4061019.0,-4.76,-6.77,11.53,2.41,-7.17,21.13,2.47,0.00,0.00\",\"2024-12-25,-105525.0,1153014.0,-1047489.0,-105525.0,0.0,-0.35,3.87,-3.51,-0.35,0.00,20.75,-1.80,0.00,0.00\",\"2024-12-26,-834861.0,-352513.0,1187374.0,-834861.0,0.0,-3.20,-1.35,4.55,-3.20,0.00,21.15,1.93,0.00,0.00\",\"2024-12-27,158961.0,2804788.0,-2963749.0,158961.0,0.0,0.67,11.83,-12.50,0.67,0.00,21.03,-0.57,0.00,0.00\",\"2024-12-30,-1367036.0,1959194.0,-592157.0,-1367036.0,0.0,-7.27,10.42,-3.15,-7.27,0.00,20.73,-1.43,0.00,0.00\",\"2024-12-31,-3943793.0,-235889.0,4179682.0,-3943793.0,0.0,-15.34,-0.92,16.25,-15.34,0.00,20.06,-3.23,0.00,0.00\",\"2025-01-02,509455.0,2216669.0,-2726124.0,509455.0,0.0,1.69,7.34,-9.03,1.69,0.00,19.61,-2.24,0.00,0.00\",\"2025-01-03,6106.0,-1064095.0,1057989.0,1082209.0,-1076103.0,0.02,-3.42,3.40,3.48,-3.46,18.99,-3.16,0.00,0.00\",\"2025-01-06,-350602.0,865815.0,-515213.0,-350602.0,0.0,-1.71,4.23,-2.51,-1.71,0.00,19.20,1.11,0.00,0.00\",\"2025-01-07,762542.0,-720985.0,-41557.0,-439033.0,1201575.0,3.03,-2.86,-0.16,-1.74,4.77,19.87,3.49,0.00,0.00\",\"2025-01-08,-787402.0,-383125.0,1170527.0,-787402.0,0.0,-3.85,-1.87,5.72,-3.85,0.00,19.68,-0.96,0.00,0.00\",\"2025-01-09,-1097236.0,-1101481.0,2198717.0,-1097236.0,0.0,-5.86,-5.88,11.75,-5.86,0.00,19.83,0.76,0.00,0.00\",\"2025-01-10,-1580614.0,1886367.0,-305753.0,-1580614.0,0.0,-7.94,9.47,-1.54,-7.94,0.00,18.94,-4.49,0.00,0.00\",\"2025-01-13,-328101.0,-409971.0,738072.0,-328101.0,0.0,-2.06,-2.57,4.63,-2.06,0.00,19.02,0.42,0.00,0.00\",\"2025-01-14,-104868.0,163486.0,-58618.0,-104868.0,0.0,-0.49,0.76,-0.27,-0.49,0.00,19.76,3.89,0.00,0.00\",\"2025-01-15,115053.0,-220601.0,105548.0,115053.0,0.0,0.52,-0.99,0.47,0.52,0.00,19.86,0.51,0.00,0.00\",\"2025-01-16,-339445.0,1229674.0,-890229.0,-433425.0,93980.0,-1.61,5.84,-4.23,-2.06,0.45,19.78,-0.40,0.00,0.00\",\"2025-01-17,-1190321.0,1559205.0,-368884.0,-1190321.0,0.0,-8.09,10.60,-2.51,-8.09,0.00,19.68,-0.51,0.00,0.00\",\"2025-01-20,-247055.0,296531.0,-49476.0,-247055.0,0.0,-1.98,2.38,-0.40,-1.98,0.00,19.91,1.17,0.00,0.00\",\"2025-01-21,-1566270.0,2179327.0,-613057.0,-1665961.0,99691.0,-9.17,12.77,-3.59,-9.76,0.58,19.65,-1.31,0.00,0.00\",\"2025-01-22,-246556.0,426698.0,-180142.0,-246556.0,0.0,-2.60,4.49,-1.90,-2.60,0.00,19.54,-0.56,0.00,0.00\",\"2025-01-23,-2010886.0,2871220.0,-860334.0,-2010886.0,0.0,-10.15,14.49,-4.34,-10.15,0.00,19.61,0.36,0.00,0.00\",\"2025-01-24,192264.0,-215397.0,23133.0,192264.0,0.0,1.20,-1.35,0.14,1.20,0.00,19.87,1.33,0.00,0.00\",\"2025-01-27,1024165.0,-1391408.0,367244.0,1024165.0,0.0,4.86,-6.60,1.74,4.86,0.00,19.85,-0.10,0.00,0.00\",\"2025-02-05,-197069.0,611336.0,-414268.0,-197069.0,0.0,-1.33,4.13,-2.80,-1.33,0.00,19.83,-0.10,0.00,0.00\",\"2025-02-06,1998537.0,144565.0,-2143101.0,1998537.0,0.0,8.96,0.65,-9.61,8.96,0.00,20.18,1.77,0.00,0.00\",\"2025-02-07,-166956.0,-2417748.0,2584704.0,-2223956.0,2057000.0,-0.48,-6.94,7.42,-6.38,5.90,20.44,1.29,0.00,0.00\",\"2025-02-10,1602538.0,160310.0,-1762848.0,1602538.0,0.0,7.13,0.71,-7.84,7.13,0.00,20.66,1.08,0.00,0.00\",\"2025-02-11,-8638285.0,5202939.0,3435346.0,-8638285.0,0.0,-31.06,18.71,12.35,-31.06,0.00,20.26,-1.94,0.00,0.00\",\"2025-02-12,-1986661.0,2196740.0,-210079.0,-771061.0,-1215600.0,-8.45,9.34,-0.89,-3.28,-5.17,20.35,0.44,0.00,0.00\",\"2025-02-13,-2405423.0,1873493.0,531930.0,-147953.0,-2257470.0,-8.92,6.95,1.97,-0.55,-8.37,19.99,-1.77,0.00,0.00\",\"2025-02-14,-3536685.0,1369248.0,2167437.0,-2108091.0,-1428594.0,-14.38,5.57,8.81,-8.57,-5.81,19.93,-0.30,0.00,0.00\",\"2025-02-17,-3499696.0,2422172.0,1077525.0,-1302766.0,-2196930.0,-12.41,8.59,3.82,-4.62,-7.79,20.17,1.20,0.00,0.00\",\"2025-02-18,2174858.0,-3840730.0,1665872.0,2174858.0,0.0,4.20,-7.42,3.22,4.20,0.00,20.00,-0.84,0.00,0.00\",\"2025-02-19,750577.0,3582766.0,-4333343.0,-999341.0,1749918.0,1.95,9.30,-11.24,-2.59,4.54,20.41,2.05,0.00,0.00\",\"2025-02-20,3447832.0,1321920.0,-4769752.0,4465832.0,-1018000.0,10.26,3.93,-14.19,13.28,-3.03,20.49,0.39,0.00,0.00\",\"2025-02-21,-1263468.0,208128.0,1055340.0,-1263468.0,0.0,-3.53,0.58,2.95,-3.53,0.00,20.57,0.39,0.00,0.00\",\"2025-02-24,-3983683.0,2675670.0,1308013.0,-3983683.0,0.0,-10.89,7.31,3.58,-10.89,0.00,20.72,0.73,0.00,0.00\",\"2025-02-25,908501.0,-336427.0,-572074.0,-123499.0,1032000.0,3.46,-1.28,-2.18,-0.47,3.93,20.51,-1.01,0.00,0.00\",\"2025-02-26,-2484786.0,-2334286.0,4819072.0,-2681493.0,196707.0,-4.42,-4.16,8.58,-4.77,0.35,20.87,1.76,0.00,0.00\",\"2025-02-27,1366722.0,-5185429.0,3818707.0,2392064.0,-1025342.0,2.70,-10.24,7.54,4.73,-2.03,20.97,0.48,0.00,0.00\",\"2025-02-28,7258338.0,-5792641.0,-1465697.0,3570466.0,3687872.0,5.70,-4.55,-1.15,2.81,2.90,21.34,1.76,0.00,0.00\",\"2025-03-03,10930035.0,-7772044.0,-3157989.0,9300033.0,1630002.0,6.17,-4.39,-1.78,5.25,0.92,22.41,5.01,0.00,0.00\",\"2025-03-04,-6353224.0,296517.0,6056706.0,-2035719.0,-4317505.0,-6.78,0.32,6.46,-2.17,-4.61,21.80,-2.72,0.00,0.00\",\"2025-03-05,-11547590.0,7140023.0,4407569.0,-7050262.0,-4497328.0,-13.96,8.63,5.33,-8.52,-5.44,21.26,-2.48,0.00,0.00\",\"2025-03-06,52882.0,4505077.0,-4557959.0,-2011934.0,2064816.0,0.08,6.96,-7.05,-3.11,3.19,21.45,0.89,0.00,0.00\",\"2025-03-07,7028244.0,-4378849.0,-2649395.0,6116844.0,911400.0,8.49,-5.29,-3.20,7.39,1.10,21.80,1.63,0.00,0.00\",\"2025-03-10,-108973.0,960274.0,-851301.0,-1479773.0,1370800.0,-0.22,1.92,-1.70,-2.96,2.74,21.73,-0.32,0.00,0.00\",\"2025-03-11,-4650626.0,5340773.0,-690147.0,-4650626.0,0.0,-9.37,10.75,-1.39,-9.37,0.00,21.60,-0.60,0.00,0.00\",\"2025-03-12,-261496.0,2412934.0,-2151438.0,-1050487.0,788991.0,-0.70,6.45,-5.75,-2.81,2.11,21.42,-0.83,0.00,0.00\",\"2025-03-13,-3110134.0,2325879.0,784255.0,-1812124.0,-1298010.0,-10.82,8.09,2.73,-6.30,-4.51,21.36,-0.28,0.00,0.00\",\"2025-03-14,-7370800.0,2029977.0,5340823.0,-6276174.0,-1094626.0,-17.43,4.80,12.63,-14.84,-2.59,21.51,0.70,0.00,0.00\",\"2025-03-17,-8593126.0,4477914.0,4115213.0,-655433.0,-7937693.0,-20.77,10.82,9.95,-1.58,-19.19,21.37,-0.65,0.00,0.00\",\"2025-03-18,4166397.0,-737080.0,-3429317.0,4769532.0,-603135.0,7.43,-1.31,-6.11,8.50,-1.07,21.88,2.39,0.00,0.00\",\"2025-03-19,9873097.0,-9934397.0,61301.0,2920671.0,6952426.0,10.14,-10.20,0.06,3.00,7.14,22.18,1.37,0.00,0.00\",\"2025-03-20,3565757.0,578094.0,-4143851.0,4926596.0,-1360839.0,3.34,0.54,-3.88,4.61,-1.27,22.48,1.35,0.00,0.00\",\"2025-03-21,-5383389.0,8751155.0,-3367766.0,-4177041.0,-1206348.0,-8.50,13.82,-5.32,-6.60,-1.90,21.90,-2.58,0.00,0.00\",\"2025-03-24,-2479558.0,3378282.0,-898724.0,-130561.0,-2348997.0,-4.14,5.63,-1.50,-0.22,-3.92,21.42,-2.19,0.00,0.00\",\"2025-03-25,-2334213.0,1852892.0,481321.0,-2334213.0,0.0,-7.50,5.96,1.55,-7.50,0.00,21.24,-0.84,0.00,0.00\",\"2025-03-26,-2121623.0,2474330.0,-352707.0,-2181404.0,59781.0,-5.77,6.72,-0.96,-5.93,0.16,21.66,1.98,0.00,0.00\",\"2025-03-27,-2213134.0,609647.0,1603487.0,-2211029.0,-2105.0,-5.97,1.64,4.32,-5.96,-0.01,21.04,-2.86,0.00,0.00\",\"2025-03-28,-3213163.0,5909385.0,-2696222.0,-2034302.0,-1178861.0,-9.02,16.59,-7.57,-5.71,-3.31,20.58,-2.19,0.00,0.00\",\"2025-03-31,-8478564.0,7623974.0,854590.0,-6026994.0,-2451570.0,-21.66,19.47,2.18,-15.39,-6.26,20.12,-2.24,0.00,0.00\",\"2025-04-01,453789.0,2239046.0,-2692835.0,441429.0,12360.0,1.15,5.66,-6.80,1.12,0.03,20.80,3.38,0.00,0.00\",\"2025-04-02,3198142.0,-2248832.0,-949310.0,2022187.0,1175955.0,10.98,-7.72,-3.26,6.94,4.04,20.90,0.48,0.00,0.00\",\"2025-04-03,-148941.0,2484281.0,-2335340.0,1393649.0,-1542590.0,-0.61,10.12,-9.51,5.68,-6.28,20.65,-1.20,0.00,0.00\",\"2025-04-07,-797293.0,-1274243.0,2071536.0,3599454.0,-4396747.0,-1.06,-1.69,2.75,4.77,-5.83,16.52,-20.00,0.00,0.00\",\"2025-04-08,-15632.0,1357404.0,-1341771.0,-15632.0,0.0,-0.03,2.65,-2.62,-0.03,0.00,17.29,4.66,0.00,0.00\",\"2025-04-09,1910491.0,2221088.0,-4131579.0,2940523.0,-1030032.0,3.71,4.32,-8.03,5.72,-2.00,17.79,2.89,0.00,0.00\",\"2025-04-10,-2894508.0,577893.0,2316615.0,-2894508.0,0.0,-7.57,1.51,6.06,-7.57,0.00,18.16,2.08,0.00,0.00\",\"2025-04-11,-1555518.0,341916.0,1213602.0,-1555518.0,0.0,-5.64,1.24,4.40,-5.64,0.00,18.12,-0.22,0.00,0.00\",\"2025-04-14,-1025277.0,881225.0,144052.0,-1025277.0,0.0,-3.90,3.35,0.55,-3.90,0.00,18.38,1.43,0.00,0.00\",\"2025-04-15,-489370.0,1030091.0,-540721.0,-489370.0,0.0,-2.85,6.00,-3.15,-2.85,0.00,18.25,-0.71,0.00,0.00\",\"2025-04-16,-2198583.0,1963733.0,234850.0,-2198583.0,0.0,-8.82,7.88,0.94,-8.82,0.00,18.01,-1.32,0.00,0.00\",\"2025-04-17,-2771355.0,1941644.0,829711.0,-1751943.0,-1019412.0,-10.04,7.03,3.01,-6.35,-3.69,18.20,1.05,0.00,0.00\",\"2025-04-18,-85272.0,432914.0,-347642.0,-85272.0,0.0,-0.43,2.16,-1.73,-0.43,0.00,18.19,-0.05,0.00,0.00\",\"2025-04-21,-1649563.0,696840.0,952723.0,-204175.0,-1445388.0,-6.45,2.72,3.73,-0.80,-5.65,18.33,0.77,0.00,0.00\",\"2025-04-22,-24972.0,1819627.0,-1794655.0,77396.0,-102368.0,-0.10,6.99,-6.90,0.30,-0.39,18.42,0.49,0.00,0.00\",\"2025-04-23,2439117.0,-2993010.0,553893.0,1860411.0,578706.0,7.29,-8.95,1.66,5.56,1.73,18.74,1.74,0.00,0.00\",\"2025-04-24,1075720.0,-791014.0,-284706.0,-774280.0,1850000.0,4.03,-2.96,-1.07,-2.90,6.92,18.46,-1.49,0.00,0.00\",\"2025-04-25,-743487.0,-4783084.0,5526571.0,-413417.0,-330070.0,-2.04,-13.13,15.17,-1.13,-0.91,18.66,1.08,0.00,0.00\",\"2025-04-28,-2128991.0,1979381.0,149610.0,19070.0,-2148061.0,-7.52,6.99,0.53,0.07,-7.58,18.39,-1.45,0.00,0.00\",\"2025-04-29,-1918550.0,3943614.0,-2025064.0,-1918550.0,0.0,-8.12,16.70,-8.58,-8.12,0.00,18.26,-0.71,0.00,0.00\",\"2025-04-30,494793.0,-1520152.0,1025359.0,494793.0,0.0,2.58,-7.92,5.35,2.58,0.00,18.31,0.27,0.00,0.00\",\"2025-05-06,2481016.0,3048599.0,-5529615.0,2481016.0,0.0,8.25,10.14,-18.39,8.25,0.00,19.03,3.93,0.00,0.00\",\"2025-05-07,-3037301.0,2483996.0,553305.0,-3037301.0,0.0,-11.52,9.42,2.10,-11.52,0.00,19.07,0.21,0.00,0.00\",\"2025-05-08,-2561151.0,1216556.0,1344595.0,-3907210.0,1346059.0,-10.10,4.80,5.30,-15.40,5.31,19.29,1.15,0.00,0.00\",\"2025-05-09,-852108.0,1861756.0,-1009648.0,-1043907.0,191799.0,-4.52,9.87,-5.35,-5.53,1.02,18.99,-1.56,0.00,0.00\",\"2025-05-12,1234102.0,-1204117.0,-29985.0,2565983.0,-1331881.0,5.92,-5.78,-0.14,12.31,-6.39,19.28,1.53,0.00,0.00\",\"2025-05-13,2284537.0,-5686882.0,3402345.0,2284537.0,0.0,6.93,-17.24,10.32,6.93,0.00,19.27,-0.05,0.00,0.00\",\"2025-05-14,-596540.0,1206655.0,-610115.0,-898940.0,302400.0,-2.22,4.48,-2.27,-3.34,1.12,19.15,-0.62,0.00,0.00\",\"2025-05-15,-2412393.0,2349076.0,63317.0,-2412393.0,0.0,-13.56,13.21,0.36,-13.56,0.00,19.00,-0.78,0.00,0.00\",\"2025-05-16,399105.0,-77371.0,-321734.0,399105.0,0.0,2.86,-0.55,-2.30,2.86,0.00,19.00,0.00,0.00,0.00\",\"2025-05-19,392700.0,1252837.0,-1645537.0,392700.0,0.0,1.67,5.31,-6.98,1.67,0.00,19.29,1.53,0.00,0.00\",\"2025-05-20,8125689.0,-9355236.0,1229547.0,7106306.0,1019383.0,11.75,-13.53,1.78,10.28,1.47,19.82,2.75,0.00,0.00\",\"2025-05-21,-1771761.0,2077057.0,-305296.0,-1771761.0,0.0,-5.93,6.95,-1.02,-5.93,0.00,19.68,-0.71,0.00,0.00\",\"2025-05-22,-2119902.0,2067160.0,52742.0,-2119902.0,0.0,-8.26,8.05,0.21,-8.26,0.00,19.20,-2.44,0.00,0.00\",\"2025-05-23,-3525204.0,2958116.0,567088.0,-96232.0,-3428972.0,-12.08,10.14,1.94,-0.33,-11.75,18.80,-2.08,0.00,0.00\",\"2025-05-26,-1787876.0,2827866.0,-1039990.0,-1787876.0,0.0,-6.95,10.99,-4.04,-6.95,0.00,18.84,0.21,0.00,0.00\",\"2025-05-27,-2187100.0,2953966.0,-766866.0,-554435.0,-1632665.0,-8.16,11.02,-2.86,-2.07,-6.09,18.78,-0.32,0.00,0.00\",\"2025-05-28,-1094750.0,523998.0,570752.0,-1330370.0,235620.0,-6.14,2.94,3.20,-7.46,1.32,18.69,-0.48,0.00,0.00\",\"2025-05-29,-482220.0,1673277.0,-1191057.0,-519780.0,37560.0,-2.46,8.55,-6.09,-2.66,0.19,18.94,1.34,0.00,0.00\",\"2025-05-30,886264.0,-1390968.0,504704.0,-984736.0,1871000.0,3.94,-6.18,2.24,-4.38,8.32,18.57,-1.95,0.00,0.00\",\"2025-06-03,658159.0,-905530.0,247371.0,658159.0,0.0,3.50,-4.82,1.32,3.50,0.00,18.73,0.86,0.00,0.00\",\"2025-06-04,368398.0,543473.0,-911871.0,368398.0,0.0,2.54,3.75,-6.29,2.54,0.00,18.88,0.80,0.00,0.00\",\"2025-06-05,1891171.0,-7222888.0,5331717.0,1819852.0,71319.0,4.72,-18.02,13.30,4.54,0.18,19.16,1.48,0.00,0.00\",\"2025-06-06,-939985.0,1287790.0,-347805.0,-939985.0,0.0,-4.07,5.58,-1.51,-4.07,0.00,19.30,0.73,0.00,0.00\",\"2025-06-09,3474635.0,465277.0,-3939911.0,2035643.0,1438992.0,12.98,1.74,-14.72,7.60,5.38,19.61,1.61,0.00,0.00\",\"2025-06-10,3226101.0,-1781876.0,-1444224.0,3226101.0,0.0,6.83,-3.77,-3.06,6.83,0.00,19.62,0.05,0.00,0.00\"]}});";
        Pattern pattern = Pattern.compile("\\(([^)]+)\\)");
        Matcher matcher = pattern.matcher(line);
        if (matcher.find()) {
            String result = matcher.group(1); // 获取第一个捕获组内容

            LinkedTreeMap m = MyUtil.getGson().fromJson(result, new TypeToken<LinkedTreeMap>() {}.getType());
            LinkedTreeMap data = (LinkedTreeMap) m.get("data");
            List klines = (List) data.get("klines");
            //String name = (String) data.get("name");

            List<Object> lst = MaiDian.getData(klines);

            List<Integer> rs = MaiDian.get_low(lst);
            for (Integer index : rs) {
                List<Object> row = (List<Object>)lst.get(index);
                //update_mai_dian(conn, symbol, row.get(11).toString(), row.get(0).toString());
                System.out.println(row);
            }
        }
    }

    @Test
    public void test_df_stock_week_h2() throws SQLException, ClassNotFoundException, IgniteCheckedException, PropertyVetoException {
        MyDongFangStockH2_wm.updateAll_w();
    }

    @Test
    public void test_df_stock_month_h2() throws SQLException, ClassNotFoundException, IgniteCheckedException, PropertyVetoException {
        MyDongFangStockH2_m.updateAll_m();
    }

    @Test
    public void test_df_stock_month_data() throws SQLException, ClassNotFoundException, IgniteCheckedException, PropertyVetoException {
        Connection conn = MyUtil.getConnection();
        MyDongFangStockH2_m.getData_m(conn, "000001");
        //MyDongFangStockH2_wm.getData_w(conn, "000001");
    }

    @Test
    public void test_db_to_db() throws IgniteCheckedException {
        DbToDb.type_to_stock();
    }

    @Test
    public void update_type_date() throws IgniteCheckedException {
        DbToDb.update_type_date();
    }

    @Test
    public void test1() throws IgniteCheckedException {
        String springCfgPath = "/Users/chenfei/Documents/Java/my_database/my-stock/src/main/resources/default-config.xml";
        Ignite ignite = IgnitionEx.start(springCfgPath);
        CacheConfiguration<?, ?> cacheCfg = new CacheConfiguration<>("public_meta");
        cacheCfg.setSqlSchema("PUBLIC");

        IgniteCache<?, ?> cache = ignite.getOrCreateCache(cacheCfg);

        MyDongFangStock.getData(cache,"601398");
    }

    @Test
    public void test_date_int() {
        MyDongFangStock.getInt();
    }
}




































